import { getDetail } from "../../api/detail";

const state = {
  goods: {
    // 初始化数据
    // 否则会报错
    categoryView: {},
    skuInfo: {
      skuImageList: [],
    },
    spuSaleAttrList: [],
  },
};
const gettters = {};
const actions = {
  async getDetail({ commit }, id) {
    const res = await getDetail(id);
    commit("GET_DETAIL", res);
  },
};
const mutations = {
  GET_DETAIL(state, goods) {
    console.log(goods);
    state.goods = goods;
  },
};

export default {
  namespaced: true,
  state,
  gettters,
  actions,
  mutations,
};
